<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>{{trans('config.webtitle')}}</title>
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

	<link rel="stylesheet" type="text/css" href="{{asset('public/org/layui/css/layui.css')}}" media="all">
	<link rel="stylesheet" href="{{asset('public/css/login.css')}}">

</head>
<body class="lc-login-bg">
	<div class="lc-login-box">
		<header>
			<h1>Sign In</h1>
		</header>
		<div class="lc-login-main">
			<form action="{{route('admin.login')}}" class="layui-form" method="post">
				{{csrf_field()}}
				<div class="layui-form-item">
					<label class="lc-login-icon">
						<i class="layui-icon">&#xe612;</i>
					</label>
					<input type="text" name="email" lay-verify="new_email" autocomplete="off" placeholder="{{ trans('config.input_email') }}" class="layui-input" lay-title="">
				</div>
				<div class="layui-form-item">
					<label class="lc-login-icon">
		            <i class="layui-icon">&#xe642;</i>
		        </label>
					<input type="password" name="password" lay-verify="new_required" autocomplete="off" placeholder="{{ trans('config.input_password') }}" class="layui-input">
				</div>
				<div class="layui-form-item">
					{{--<div class="lc-pull-left lc-login-remember">
						<label>记住帐号？</label>
						<input type="checkbox" name="remember" {{ old('remember') ? 'checked' : '' }} lay-skin="switch" title="记住帐号">
					</div>--}}
					<div class="lc-pull-right">
						<button class="layui-btn layui-btn-primary" lay-submit lay-filter="login">
		                <i class="layui-icon">&#xe650;</i> {{trans('config.login_submit')}}
		            </button>
					</div>
					<div class="lc-clear"></div>
				</div>
			</form>
		</div>
		<footer>
			<p>Luck48 © 2017usaedu</p>
		</footer>
	</div>
	
	<script src="{{asset('public/org/layui/layui.js')}}"></script>
	<script>
	layui.use(['layer', 'form','jquery'], function() {
		var layer = layui.layer,
			form=layui.form(),
			$ = layui.jquery;
		form.verify({
			new_email:function(value){
				if(!/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(value)){
					return "{{ trans('config.vali_email') }}";
				}
			},
			new_required:function(value){
				if(!/[\S]+/.test(value)){
					return "{{ trans('config.vali_required') }}";
				}
			}
		});

		var load1;
		form.on('submit(login)',function(data){
			$.ajax({
				url:"{{route('admin.login')}}",
				type:"post",
				data:data.field,
				beforeSend:function(){
					load1=layer.load(1, {
						shade: [0.1,'#fff']
					});
				},
				success:function(data){
					if(data.status==200){
						layer.msg(data.msg,{icon:1,shift:5});
						location.href="{{url('admin')}}";
					}else{
						layer.msg(data.msg,{icon: 5,shift:6});
					}
				},
				complete:function(){
					layer.close(load1);
				},
				error:function(){
					layer.msg("{{trans('config.connect')}}",{icon: 5,shift:6});
				}
			})
			return false;
		});
	});
	</script>
</body>
</html>